import request from "./request.js"
import api from "./api.js"

// 是否登录（token是否失效）
function is_login(){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.isLogin,
		method: 'GET'
	})
}
// 获取openId
function login_get_openId(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.getOpenId,
		method: 'GET',
		data: params
	})
}
// 解密获取unionId或手机号码
function decrypt_wx(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.decryptWeixinData,
		method: 'POST',
		data: params
	})
}
// 判断是否绑定微信
function is_bind_wx(params) {
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.isBindwx,
		method: 'POST',
		data: params
	})
}
// 微信登录获取token
function wx_login(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.wxLogin,
		method: 'POST',
		data: params
	})
}
// 绑定微信
function wx_bind(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.wxBind,
		method: 'POST',
		data: params
	})
}
// 绑定手机
function wx_bind_phone(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.wxBindPhone,
		method: 'POST',
		data: params
	})
}
// 账号密码登录
function login_by_password(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.loginByPassword,
		method: 'POST',
		data: params
	})
}
// 发送验证码
function send_code(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.sendCode,
		method: 'POST',
		data: params
	})
}
// 验证手机验证码
function very_code(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.veryCode,
		method: 'POST',
		data: params
	})
}
// 手机验证码登录
function login_by_code(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.loginByCode,
		method: 'POST',
		data: params
	})
}
// 验证码设置密码
function set_password_bycode(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.setPasswordBycode,
		method: 'POST',
		data: params
	})
}
// 原密码设置密码
function set_password_byold(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.setPasswordByold,
		method: 'POST',
		data: params
	})
}
// 更换手机号
function change_phone(params) {
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.changePhone,
		method: 'POST',
		data: params
	})
}
// 解绑微信
function unbind_wx(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.unbindWx,
		method: 'POST',
		data: params
	})
}
// 退出登录
function out_login(){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.outLogin,
		method: 'GET'
	})
}
// 获取省
function get_province_list(){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.getProvinceList,
		method: 'GET'
	})
}
// 获取市
function get_city_list(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.getCityList,
		method: 'GET',
		data: params
	})
}
// 获取区
function get_area_list(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.getAreaList,
		method: 'GET',
		data: params
	})
}
// 防重复提交幂等token
function create_token(){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.createToken,
		method: 'GET',
	})
}
// 获取当前用户的身份
function isFirstLogin(){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.isFirstLogin,
		method: 'GET',
	})
}
// 获取oss
function get_oss(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.uploadOssFile,
		method: 'GET',
		data: params
	})
}
// 认证机构
function register_mech(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.registerMech,
		method: 'POST',
		data: params
	})
}
// 机构认证列表
function get_org_list(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.getOrgList,
		method: 'GET',
		data: params
	})
}
// 机构认证列表
function get_org_type(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.getOrgType,
		method: 'GET',
		data: params
	})
}
// 修改个人简历状态
function edit_user_resume(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.editUserResume,
		method: 'POST',
		data: params
	})
}
// 屏蔽公司列表
function get_corpor_list(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.getCorporList,
		method: 'GET',
		data: params
	})
}
// 屏蔽公司列表
function cancel_corpor(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.cancelCorpor,
		method: 'GET',
		data: params
	})
}
// 新增屏蔽公司列表
function add_corpor(params){
	return new request.tokenRequest({
		url: api.data.requestUrl + api.data.addCorpor,
		method: 'POST',
		data: params
	})
}
// 用户反馈
function set_feedback(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.setFeedback,
		method: 'POST',
		data: params
	})
}
// 版本信息
function get_version(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.getVersion,
		method: 'GET',
		data: params
	})
}
// 是否绑定appleId
function apple_bind(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.appleBind,
		method: 'POST',
		data: params
	})
}
// 绑定appleId
function login_by_apple(params){
	return new request.baseRequest({
		url: api.data.requestUrl + api.data.loginByApple,
		method: 'POST',
		data: params
	})
}

module.exports = {
	is_login: is_login,
	login_get_openId: login_get_openId,
	decrypt_wx: decrypt_wx,
	is_bind_wx: is_bind_wx,
	wx_login: wx_login,
	wx_bind: wx_bind,
	wx_bind_phone: wx_bind_phone,
	login_by_password: login_by_password,
	send_code: send_code,
	very_code: very_code,
	login_by_code: login_by_code,
	set_password_bycode: set_password_bycode,
	set_password_byold: set_password_byold,
	change_phone: change_phone,
	unbind_wx: unbind_wx,
	out_login: out_login,
	get_province_list: get_province_list,
	get_city_list: get_city_list,
	get_area_list: get_area_list,
	create_token: create_token,
	isFirstLogin,
	get_oss: get_oss,
	register_mech: register_mech,
	get_org_list: get_org_list,
	get_org_type: get_org_type,
	set_feedback: set_feedback,
	get_version: get_version,
	edit_user_resume: edit_user_resume,
	get_corpor_list: get_corpor_list,
	cancel_corpor: cancel_corpor,
	add_corpor: add_corpor,
	apple_bind,
	login_by_apple
}